package com.zzqstart.bannerservice.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zzqstart.bannerservice.entity.Banner;
import com.zzqstart.bannerservice.service.BannerService;
import com.zzqstart.commonutils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2023-03-06
 */
@Api(tags = "前台显示轮播图")
@RestController
@RequestMapping("/bannerservice/front")
public class BannerFrontController {

    @Autowired
    private BannerService BannerService;

    @ApiOperation(value = "按最新时间获取三个轮播图信息")
    @Cacheable(key = "'selectIndexList'", value = "banner")
    @GetMapping("/getAllBanner")
    public R getAllBannner() {
        List<Banner> BannerList = BannerService.getPartBanner();
        return R.ok().data("list", BannerList);
    }

}

